package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30);noot null"`
	Password string `gorm:"type:char(32);not null"`
}

func (u *User) FirstUserByUserName(db *gorm.DB, Username string) error {
	return db.Debug().Where("username=?", Username).Find(u).Error
}

func (u *User) FirstUserByUserId(db *gorm.DB, id int64) error {
	return db.Debug().Where("id=?", id).First(u).Error
}
